home *** CD-ROM | disk | FTP | other *** search
- /*
- ***********************************************************************
- *
- *
- * Event Handler Classes
- * Implementation
- *
- *
- ***********************************************************************
- */
-
- #include "EventHandlers.h"
- #include "window.h"
- #include "mymenv.h"
-
- #if 0
- // Pointer to a null event handler on the top
- // of the chain of registered handlers.
- // For now we don't have a chain, actually
- // so this points to the only one event handler,
- // or nil
- NullEventHandler * NullEventHandler::first_handler = nil;
- #endif
-
- // Event handling loop. Returns only when the
- // WindowObject is to be destroyed
- // Performs a very basic dispatching of a received event
- void EventHandler::loop(void)
- {
- for(;;)
- {
- if( !WaitNextEvent(everyEvent, &the_event, event_timeout, nil) )
- if( serviced_window.handle_null_event(the_event.when) )
- continue;
- else
- return; // Null event handler decided it's time to quit
-
- if( the_event.what == kHighLevelEvent )
- {
- //do_well( AEProcessAppleEvent(&the_event) ); // are Apple events
- continue;
- }
-
- if( !serviced_window.handle_event(the_event) )
- return; // The handler decided it doesn't want any more events
- }
- }
-